package com.song.rabbitmq.springbootorderrabbitmqconsumertopic.service;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Service;

@RabbitListener(bindings =@QueueBinding(
        value = @Queue(value = "queue_order_paid",autoDelete = "false"),
        exchange = @Exchange(value = "topic_order_exchange",type = ExchangeTypes.TOPIC),
        key = "order.paid"
))
@Service
public class OrderPaidService {

    @RabbitHandler
    public void paidOrder(String message){
        // 此处省略发邮件的逻辑
        System.out.println("paidOrder-------------->" + message);
    }
}
